<!-- 页面 -->
<template>
    <div class="zhu">
        <div class="zhup">
            <p class="zhup1">很高兴您将成为商城的会员（注册只需一步）</p>
        </div>
        <div>
            <input type="text" @blur="szhu1()" :class="mobile1=='1'? 'szhu1' :'' " v-model="mobile" placeholder="手机号码">
            <input type="text" @blur="szhu2()" :class="mobile2=='1'? 'szhu2' :'' " v-model="pwd" placeholder="密码">
            <input type="text" @blur="szhu3()" :class="mobile3=='1'? 'szhu3' :'' "  v-model="pwd1" placeholder="确认密码">
            <input type="text" @blur="szhu4()" :class="mobile4=='1'? 'szhu4' :'' "  v-model="nick" placeholder="用户名">
            <input class="inp" type="text">
            <input type="text" @blur="szhu5()" :class="mobile5=='1'? 'szhu5' :'' "  ><img src="" alt="">
            <input class="inp" @blur="szhu6()" :class="mobile6=='1'? 'szhu6' :'' "  v-model="code" type="text"><button @click="huo()" class="fas">获取验证码</button>
        </div>
        <div class="zhuo">
            <button @click="zhuce()">立即注册</button> 
            <p class="zhuo2" @click="zhu()">已有账号？ 立即登录</p>
        </div>
    </div>
</template>
<!-- vue -->
<script>
import axios from 'axios'

export default {
    data() {
        return {
            // 声明的属性
            mobile:'',//注册的手机号
            pwd:'',//密码
            pwd1:'',
            code:'',//短信验证码
            nick:'',//昵称
            mobile1:0,
            mobile2:0,
            mobile3:0,
            mobile4:0,
            mobile5:0,
            mobile6:0,
        }
    },
    //生命周期函数
    mounted() {

    },
    // 调用方法
    methods: {
        huo(){
            this.$axios.post('https://api.it120.cc/small4/verification/pic/get',{
                key:123   
            }).then(res=>{
                console.log(res);
            })
        },
        zhu(){
            this.$router.push('/dl')
        },
        zhuce(){
            this.$axios.post('https://api.it120.cc/small4/user/m/register',{
                mobile:this.mobile,
                pwd:this.pwd,
                code:this.code,
                nick:this.nick
            }).then(res=>{
                console.log(res);
            })
        },
        szhu1(){
            if(this.mobile==''){
                this.mobile1 = 1
                alert('手机号不能为空')
            }else{
                this.mobile1 = 0
            }
        },
        szhu2(){
            if(this.pwd==''){
                alert('密码不能为空')
                this.mobile2 = 1
            }else{
                this.mobile2 = 0
            }
        },
        szhu3(){
            if(this.pwd1==''){
                this.mobile3 = 1
            }else if(this.pwd1 != this.pwd){
                alert('与密码不一致')
                this.mobile3 = 1
            }
            else{
                this.mobile3 = 0
            }
        },
        szhu4(){
            if(this.pwd==''){
                alert('用户名不能为空')
                this.mobile4 = 1
            }else{
                this.mobile4 = 0
            }
        },
        
        szhu5(){
            if(this.nick ==''){
                alert('昵称能为空')
                this.mobile5 = 1
            }else{
                this.mobile5 = 0
            }
        },
        szhu6(){
            if(this.code==''){
                alert('验证码不能为空')
                this.mobile6 = 1
            }else{
                this.mobile6 = 0
            }
        },
    },
    // 监听器
    watch: {
    },
    // 计算属性
    computed: {
    },
    // 过滤器
    filters: {
    },
    // 自定义指令
    directives: {
    }
}
</script>
<!-- css样式 -->
<style>
.zhu {
    width: 100%;
    height: 100%;

}

.zhu .zhup {
    margin-top: 4.125rem;
    width: 260px;
    height: 60px;
    margin-left: 32px;
}

.zhu .zhup1 {
    font-size: 1.0rem;
}

.zhu .zhup2 {
    font-size: .8125rem;
    color: #c5c5c5;
    margin-top: 1.25rem;
}

.zhu input {
    width: 16.25rem;
    height: 50px;
    border: 0rem;
    background: #f5f5f5;
    margin-top: 10px;
    margin-left: 32px;
}
.zhu button{
    width: 11.875rem;
    height: 2.125rem;
    color: white;
    background:linear-gradient(#e078e5,#80edfa);
    border: 0rem ;
}
.zhu .zhuo{
    width: 11.875rem;
    height: 160px;
    margin: 20px 56px;
}
.zhu .zhuo .zhuo1{
    margin-top: 1.25rem;
    width: 100%;
    text-align: center;
    font-size: .625rem;
    color: #c5c5c5;
}
.zhu .zhuo .zhuo2{
    margin-top: 1.25rem;
    width: 100%;
    text-align: center;
    font-size: 1.125rem;
    color: blue;
}
.zhu .inp{
    width: 40%;
}
.zhu .fas{
    width: 7.875rem;
    height: 3.125rem;
    color: black;
    background: #f5f5f5;
    border: 0px;
}
.zhu .szhu1{
    border: 1px solid red;
    background: #ffe9e5;
}
.zhu .szhu2{
    border: 1px solid red;
    background: #ffe9e5;
}
.zhu .szhu3{
    border: 1px solid red;
    background: #ffe9e5;
}
.zhu .szhu4{
    border: 1px solid red;
    background: #ffe9e5;
}
.zhu .szhu5{
    border: 1px solid red;
    background: #ffe9e5;
}
.zhu .szhu6{
    border: 1px solid red;
    background: #ffe9e5;
}
</style>    